#ifndef __SMARTLOCK_MOTION_DA281_H__
#define __SMARTLOCK_MOTION_DA281_H__


#define MS_SCL	43
#define	MS_SDA	44

/******************************************************
	Motion sensor controller register macro define
*******************************************************/
#define MS_CHIP_ID		0x01
#define MS_ACC_X_LSB		0x02
#define MS_ACC_X_MSB		0x03
#define MS_ACC_Y_LSB		0x04
#define MS_ACC_Y_MSB		0x05
#define MS_ACC_Z_LSB		0x06
#define MS_ACC_Z_MSB		0x07

#define MS_MOTION_FLAG 0x09
#define TAP_ACTIVE_STATUS 0x0b

#define MS_MODE_BW 0x11

#define INT_SET1 0x16
#define INT_SET2 0x17
#define INT_MAP1 0x19
#define INT_MAP2 0x1a
#define INT_MAP3 0x1b
#define INT_CONFIG 0x20
#define INT_LATCH 0x21

#define FREEFAILL_DUR 0x22
#define FREEFAILL_THS 0x23
#define FREEFAILL_HYST 0x24

#define ACTIVE_DUR 	0x27
#define ACTIVE_THS  0x28

#define TAP_DUR 0x2a
#define TAP_THS 0x2b

#define ORIENT_HYST 0x2c

/******************************************************
	I2C header (slaver address|W/R)   macro define
*******************************************************/
//#define MS_SLAVEADDR_W	0x4e	//0x0100 1110
//#define MS_SLAVEADDR_R	0x4f	//0x0100 1111

/******************************************************
	GPIO macro define for software I2C
*******************************************************/
#define MS_CLK_PIN_GPIO_MODE		GPIO_ModeSetup(MS_SCL,0)
#define	MS_DATA_PIN_GPIO_MODE		GPIO_ModeSetup(MS_SDA,0)
#define MS_I2C_CLK_OUTPUT			GPIO_InitIO(OUTPUT,MS_SCL)
#define MS_I2C_DATA_OUTPUT			GPIO_InitIO(OUTPUT,MS_SDA)
#define MS_I2C_DATA_INPUT		   	GPIO_InitIO(INPUT,MS_SDA)
#define MS_I2C_CLK_HIGH				GPIO_WriteIO(1,MS_SCL)
#define MS_I2C_CLK_LOW				GPIO_WriteIO(0,MS_SCL)
#define MS_I2C_DATA_HIGH			GPIO_WriteIO(1,MS_SDA)
#define MS_I2C_DATA_LOW				GPIO_WriteIO(0,MS_SDA)
#define MS_I2C_GET_BIT				GPIO_ReadIO(MS_SDA)

#define MS_CLK_PIN_I2C_MODE		GPIO_ModeSetup(MS_SCL,1)
#define	MS_DATA_PIN_I2C_MODE		GPIO_ModeSetup(MS_SDA,1)

void DA281_init(void);

#endif	//__SMARTLOCK_MOTION_DA281_H__